#tag Class
Class NSWorkspace
Inherits NSObject
	#tag Method, Flags = &h0
		Function ApplicationFile(appName as String) As FolderItem
		  
		  #if targetMacOS
		    declare function fullPathForApplication lib CocoaLib selector "fullPathForApplication:" (obj_id as Ptr, appName as CFStringRef) as CFStringRef
		    
		    dim appPath as String = fullPathForApplication(self, appName)
		    
		    dim appFile as FolderItem
		    if appPath <> "" then
		      appFile = getFolderItem(appPath, FolderItem.PathTypeShell)
		    end if
		    
		    return appFile
		    
		  #else
		    #pragma unused appName
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function ApplicationURL(bundleID as String) As NSURL
		  
		  #if targetMacOS
		    declare function URLForApplicationWithBundleIdentifier lib CocoaLib selector "URLForApplicationWithBundleIdentifier:" _
		    (obj_id as Ptr, bundleIdentifier as CFStringRef) as Ptr
		    
		    dim urlRef as Ptr = URLForApplicationWithBundleIdentifier(self, bundleID)
		    if urlRef <> nil then
		      return new NSURL(urlRef)
		    end if
		    
		  #else
		    #pragma unused bundleID
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function ApplicationURLForFileURL(fileURL as NSURL) As NSURL
		  
		  #if targetMacOS
		    declare function URLForApplicationToOpenURL lib CocoaLib selector "URLForApplicationToOpenURL:" (obj_id as Ptr, aURL as Ptr) as Ptr
		    
		    dim fileURLRef as Ptr
		    if fileURL <> nil then
		      fileURLRef = fileURL
		    end if
		    
		    dim urlRef as Ptr = URLForApplicationToOpenURL(self, fileURLRef)
		    
		    if urlRef <> nil then
		      return new NSURL(urlRef)
		    end if
		    
		  #else
		    #pragma unused fileURL
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function BundleFile(bundleID as String) As FolderItem
		  
		  #if targetMacOS
		    declare function absolutePathForAppBundleWithIdentifier lib CocoaLib selector "absolutePathForAppBundleWithIdentifier:" _
		    (obj_id as Ptr, bundleIdentifier as CFStringRef) as CFStringRef
		    
		    dim bundlePath as String = absolutePathForAppBundleWithIdentifier(self, bundleID)
		    
		    dim bundleFile as FolderItem
		    if bundlePath <> "" then
		      bundleFile = getFolderItem(bundlePath, FolderItem.PathTypeShell)
		    end if
		    
		    return bundleFile
		    
		  #else
		    #pragma unused bundleID
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function DesktopImageURL(aScreen as NSScreen) As NSURL
		  
		  #if targetMacOS
		    declare function desktopImageURLForScreen lib CocoaLib selector "desktopImageURLForScreen:" (obj_id as Ptr, aScreen as Ptr) as Ptr
		    
		    dim screenRef as Ptr
		    if aScreen <> nil then
		      screenRef = aScreen
		    end if
		    
		    dim urlRef as Ptr = desktopImageURLForScreen(self, screenRef)
		    
		    if urlRef <> nil then
		      return new NSURL(urlRef)
		    end if
		    
		  #else
		    #pragma unused aScreen
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub DuplicateURLs(URLs() as NSURL)
		  
		  #if targetMacOS
		    declare sub duplicateURLs lib CocoaLib selector "duplicateURLs:completionHandler:" (obj_id as Ptr, URLs as Ptr, handler as Ptr)
		    
		    if URLs.ubound > -1 then
		      dim URLsArray as NSArray = NSArray.CreateWithObjects(URLs)
		      duplicateURLs self, URLsArray, nil
		    end if
		    
		  #else
		    #pragma unused URLs
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FileIcon(file as FolderItem) As NSImage
		  
		  #if targetMacOS
		    declare function iconForFile lib CocoaLib selector "iconForFile:" (obj_id as Ptr, fullPath as CFStringRef) as Ptr
		    
		    if file <> nil then
		      dim imageRef as Ptr = iconForFile(self, file.POSIXPath)
		      if imageRef <> nil then
		        return new NSImage(imageRef)
		      end if
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FileIcon(file as FolderItem, options as UInt32, image as NSImage) As Boolean
		  
		  #if targetMacOS
		    declare function setIcon lib CocoaLib selector "setIcon:forFile:options:" (obj_id as Ptr, image as Ptr, fullPath as CFStringRef, options as UInt32) as Boolean
		    
		    if file <> nil and image <> nil then
		      return setIcon(self, image, file.POSIXPath, options)
		    end if
		    
		  #else
		    #pragma unused image
		    #pragma unused file
		    #pragma unused options
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FileInfo(file as FolderItem, byRef appName as String, byRef fileType as String) As Boolean
		  
		  #if targetMacOS
		    declare function getInfoForFile lib CocoaLib selector "getInfoForFile:application:type:" _
		    (obj_id as Ptr, fullPath as CFStringRef, byRef appName as CFStringRef, byRef type as CFStringRef) as Boolean
		    
		    if file <> nil then
		      dim appNameRef, fileTypeRef as CFStringRef
		      dim retValue as Boolean = getInfoForFile(self, file.POSIXPath, appNameRef, fileTypeRef)
		      appName = appNameRef
		      fileType = fileTypeRef
		      return retValue
		    end if
		    
		  #else
		    #pragma unused file
		    #pragma unused appName
		    #pragma unused fileType
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FilesIcon(files() as FolderItem) As NSImage
		  
		  #if targetMacOS
		    declare function iconForFiles lib CocoaLib selector "iconForFiles:" (obj_id as Ptr, fullPaths as Ptr) as Ptr
		    
		    if files.ubound > -1 then
		      dim pathsArray as new NSMutableArray(files.ubound+1)
		      for each file as FolderItem in files
		        pathsArray.Append new NSString(file.POSIXPath)
		      next
		      
		      dim imageRef as Ptr = iconForFiles(self, pathsArray)
		      
		      if imageRef <> nil then
		        return new NSImage(imageRef)
		      end if
		      
		    end if
		    
		  #else
		    #pragma unused files
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FileSystemInfo(mountPoint as FolderItem, byRef isRemovable as Boolean, byRef isWritable as Boolean, byRef isUnmountable as Boolean, byRef description as String, byRef type as String) As Boolean
		  
		  #if targetMacOS
		    declare function getFileSystemInfoForPath lib CocoaLib selector "getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:" _
		    (obj_id as Ptr, _
		    fullPath as CFStringRef, _
		    byRef removableFlag as Boolean, _
		    byRef writableFlag as Boolean, _
		    byRef unmountableFlag as Boolean, _
		    byRef description as CFStringRef, _
		    byRef type as CFStringRef) as Boolean
		    
		    if mountPoint <> nil then
		      dim descriptionRef, typeRef as CFStringRef
		      dim retValue as Boolean = getFileSystemInfoForPath(self, mountPoint.POSIXPath, isRemovable, isWritable, isUnmountable, descriptionRef, typeRef)
		      description = descriptionRef
		      type = typeRef
		      return retValue
		    end if
		    
		  #else
		    #pragma unused mountPoint
		    #pragma unused isRemovable
		    #pragma unused isWritable
		    #pragma unused isUnmountable
		    #pragma unused description
		    #pragma unused type
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FileTypeIcon(fileType as String) As NSImage
		  
		  #if targetMacOS
		    declare function iconForFileType lib CocoaLib selector "iconForFileType:" (obj_id as Ptr, fileType as CFStringRef) as Ptr
		    
		    dim imageRef as Ptr = iconForFileType(self, fileType)
		    if imageRef <> nil then
		      return new NSImage(imageRef)
		    end if
		    
		  #else
		    #pragma unused fileType
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FinderLabelColors() As NSColor()
		  
		  #if TargetMacOS
		    declare function fileLabelColors lib CocoaLib selector "fileLabelColors" (obj_id as Ptr) as Ptr
		    
		    dim retArray() as NSColor
		    
		    dim arrayRef as Ptr = fileLabelColors(self)
		    if arrayRef <> nil then
		      dim ns_array as new NSArray(arrayRef)
		      const sizeOfPtr = 4
		      dim arrayRange as Cocoa.NSRange = Cocoa.NSMakeRange(0, ns_array.Count)
		      dim m as MemoryBlock = ns_array.ValuesArray(arrayRange)
		      dim n as UInt32 = arrayRange.length-1
		      for i as integer = 0 to n
		        retArray.append new NSColor(Ptr(m.UInt32Value(i*sizeOfPtr)))
		      next
		    end if
		    
		    return retArray
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function FinderLabels() As String()
		  
		  #if TargetMacOS
		    declare function fileLabels lib CocoaLib selector "fileLabels" (obj_id as Ptr) as Ptr
		    
		    dim rb_array() as String
		    
		    dim arrayRef as Ptr = fileLabels(self)
		    if arrayRef <> nil then
		      rb_array = new NSArray(arrayRef)
		    end if
		    
		    return rb_array
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub HideOtherApplications()
		  
		  #if TargetMacOS
		    declare sub hideOtherApplications lib CocoaLib selector "hideOtherApplications" (obj_id as Ptr)
		    
		    hideOtherApplications self
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function IsFilePackage(file as FolderItem) As Boolean
		  
		  #if targetMacOS
		    declare function isFilePackageAtPath lib CocoaLib selector "isFilePackageAtPath:" (obj_id as Ptr, fullPath as CFStringRef) as Boolean
		    
		    if file <> nil then
		      return isFilePackageAtPath(self, file.POSIXPath)
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function IsValidExtension(fileExtension as String, UTIname as String) As Boolean
		  
		  #if targetMacOS
		    declare function filenameExtension lib CocoaLib selector "filenameExtension:isValidForType:" _
		    (obj_id as Ptr, filenameExtension as CFStringRef, typeName as CFStringRef) as Boolean
		    
		    return filenameExtension(self, fileExtension, UTIname)
		    
		  #else
		    #pragma unused fileExtension
		    #pragma unused UTIname
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function LaunchApplication(aURL as NSURL, options as UInt32, configuration as NSDictionary, byRef error as NSError) As NSRunningApplication
		  
		  #if targetMacOS
		    declare function launchApplicationAtURL lib CocoaLib selector "launchApplicationAtURL:options:configuration:error:" _
		    (obj_id as Ptr, aURL as Ptr, options as UInt32, configuration as Ptr, byRef error as Ptr) as Ptr
		    
		    
		    dim urlRef as Ptr
		    if aURL <> nil then
		      urlRef = aURL
		    end if
		    
		    dim confRef as Ptr
		    if configuration <> nil then
		      confRef = configuration
		    end if
		    
		    dim errorRef as Ptr
		    
		    dim runappRef as Ptr =  launchApplicationAtURL(self, urlRef, options, confRef, errorRef)
		    
		    if errorRef <> nil then
		      error = new NSError(errorRef)
		    end if
		    
		    if runappRef <> nil then
		      return new NSRunningApplication(runappRef)
		    end if
		    
		  #else
		    #pragma unused aURL
		    #pragma unused options
		    #pragma unused configuration
		    #pragma unused error
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function LaunchApplication(appName as String) As Boolean
		  
		  #if targetMacOS
		    declare function launchApplication lib CocoaLib selector "launchApplication:" (obj_id as Ptr, appName as CFStringRef) as Boolean
		    
		    return launchApplication(self, appName)
		    
		  #else
		    #pragma unused appName
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function LaunchApplication(appName as String, showIcon as Boolean, autolaunch as Boolean) As Boolean
		  
		  #if targetMacOS
		    declare function launchApplication lib CocoaLib selector "launchApplication:showIcon:autolaunch:" _
		    (obj_id as Ptr, appName as CFStringRef, showIcon as Boolean, autolaunch as Boolean) as Boolean
		    
		    return launchApplication(self, appName, showIcon, autolaunch)
		    
		  #else
		    #pragma unused appName
		    #pragma unused showIcon
		    #pragma unused autolaunch
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function NotificationCenter() As NSNotificationCenter
		  
		  #if TargetMacOS
		    declare function notificationCenter lib CocoaLib selector "notificationCenter" (obj_id as Ptr) as Ptr
		    
		    dim centerRef as Ptr = notificationCenter(self)
		    if centerRef <> nil then
		      return new NSNotificationCenter(centerRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSApplicationFileType() As String
		  
		  return Cocoa.StringConstant("NSApplicationFileType")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSDirectoryFileType() As String
		  
		  return Cocoa.StringConstant("NSDirectoryFileType")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSFilesystemFileType() As String
		  
		  return Cocoa.StringConstant("NSFilesystemFileType")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSPlainFileType() As String
		  
		  return Cocoa.StringConstant("NSPlainFileType")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSShellCommandFileType() As String
		  
		  return Cocoa.StringConstant("NSShellCommandFileType")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceApplicationKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceApplicationKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceCompressOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceCompressOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceCopyOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceCopyOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDecompressOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDecompressOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDecryptOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDecryptOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDesktopImageAllowClippingKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDesktopImageAllowClippingKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDesktopImageFillColorKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDesktopImageFillColorKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDesktopImageScalingKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDesktopImageScalingKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDestroyOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDestroyOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceDuplicateOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceDuplicateOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceEncryptOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceEncryptOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceLaunchConfigurationAppleEvent() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceLaunchConfigurationAppleEvent")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceLaunchConfigurationArchitecture() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceLaunchConfigurationArchitecture")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceLaunchConfigurationArguments() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceLaunchConfigurationArguments")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceLaunchConfigurationEnvironment() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceLaunchConfigurationEnvironment")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceLinkOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceLinkOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceMoveOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceMoveOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceRecycleOperation() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceRecycleOperation")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceVolumeLocalizedNameKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceVolumeLocalizedNameKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceVolumeOldLocalizedNameKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceVolumeOldLocalizedNameKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceVolumeOldURLKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceVolumeOldURLKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function NSWorkspaceVolumeURLKey() As String
		  
		  return Cocoa.StringConstant("NSWorkspaceVolumeURLKey")
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function OpenFile(file as FolderItem) As Boolean
		  
		  #if targetMacOS
		    declare function openFile lib CocoaLib selector "openFile:" (obj_id as Ptr, fullPath as CFStringRef) as Boolean
		    
		    if file <> nil then
		      return openFile(self, file.POSIXPath)
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function OpenFile(file as FolderItem, fromImage as NSImage, point as Cocoa.NSPoint, inView as NSView) As Boolean
		  
		  #if targetMacOS
		    declare function openFile lib CocoaLib selector "openFile:fromImage:at:inView:" _
		    (obj_id as Ptr, fullPath as CFStringRef, anImage as Ptr, point as Cocoa.NSPoint, aView as Ptr) as Boolean
		    
		    if file <> nil then
		      
		      dim imageRef as Ptr
		      if fromImage <> nil then
		        imageRef = fromImage
		      end if
		      
		      dim viewRef as Ptr
		      if inView <> nil then
		        viewRef = inView
		      end if
		      
		      return openFile(self, file.POSIXPath, imageRef, point, viewRef)
		      
		    end if
		    
		  #else
		    #pragma unused file
		    #pragma unused fromImage
		    #pragma unused point
		    #pragma unused inView
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function OpenFile(file as FolderItem, withApp as String) As Boolean
		  
		  #if targetMacOS
		    declare function openFile lib CocoaLib selector "openFile:withApplication:" (obj_id as Ptr, fullPath as CFStringRef, appName as CFStringRef) as Boolean
		    
		    if file <> nil then
		      return openFile(self, file.POSIXPath, withApp)
		    end if
		    
		  #else
		    #pragma unused file
		    #pragma unused withApp
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function OpenFile(file as FolderItem, withApp as String, deactivate as Boolean) As Boolean
		  
		  #if targetMacOS
		    declare function openFile lib CocoaLib selector "openFile:withApplication:andDeactivate:" _
		    (obj_id as Ptr, fullPath as CFStringRef, appName as CFStringRef, flag as Boolean) as Boolean
		    
		    if file <> nil then
		      return openFile(self, file.POSIXPath, withApp, deactivate)
		    end if
		    
		  #else
		    #pragma unused file
		    #pragma unused withApp
		    #pragma unused deactivate
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function OpenURL(aURL as NSURL) As Boolean
		  
		  #if targetMacOS
		    declare function openURL lib CocoaLib selector "openURL:" (obj_id as Ptr, aURL as Ptr) as Boolean
		    
		    dim urlRef as Ptr
		    if aURL <> nil then
		      urlRef = aURL
		    end if
		    
		    return openURL(self, urlRef)
		    
		  #else
		    #pragma unused aURL
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function PerformFileOperation(operation as String, sourceDir as FolderItem, destDir as FolderItem, fileNames() as String, byRef tag as Integer) As Boolean
		  
		  #if targetMacOS
		    declare function performFileOperation lib CocoaLib selector "performFileOperation:source:destination:files:tag:" _
		    (obj_id as Ptr, operation as CFStringRef, sourceDir as CFstringRef, destDir as CFStringRef, fileNames as Ptr, byRef tag as Integer) as Boolean
		    
		    if sourceDir <> nil then
		      dim arrayRef as Ptr
		      dim arrayNames as NSArray
		      if fileNames.ubound > -1 then
		        arrayNames = new NSArray(fileNames)
		        arrayRef = arrayNames
		      end if
		      
		      dim destinationPath as string
		      if destDir <> nil then
		        destinationPath = destDir.POSIXPath
		      end if
		      
		      return performFileOperation(self, operation, sourceDir.POSIXPath, destinationPath, arrayRef, tag)
		      
		    end if
		    
		  #else
		    #pragma unused operation
		    #pragma unused sourceDir
		    #pragma unused destDir
		    #pragma unused fileNames
		    #pragma unused tag
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub RecycleURLs(URLs() as NSURL)
		  
		  #if targetMacOS
		    declare sub recycleURLs lib CocoaLib selector "recycleURLs:completionHandler:" (obj_id as Ptr, URLs as Ptr, handler as Ptr)
		    
		    if URLs.ubound > -1 then
		      dim URLsArray as NSArray = NSArray.CreateWithObjects(URLs)
		      recycleURLs self, URLsArray, nil
		    end if
		    
		  #else
		    #pragma unused URLs
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Sub RevealFileURLs(fileURLs() as NSURL)
		  
		  #if targetMacOS
		    declare sub activateFileViewerSelectingURLs lib CocoaLib selector "activateFileViewerSelectingURLs:" (obj_id as Ptr, fileURLs as Ptr)
		    
		    if fileURLs.ubound > -1 then
		      dim URLsArray as NSArray = NSArray.CreateWithObjects(fileURLs)
		      activateFileViewerSelectingURLs(self, URLsArray)
		    end if
		    
		  #else
		    #pragma unused fileURLs
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function RunningApplications() As NSRunningApplication()
		  
		  #if targetMacOS
		    declare function runningApplications lib CocoaLib selector "runningApplications" (obj_id as Ptr) as Ptr
		    
		    dim retArray() as NSRunningApplication
		    
		    dim arrayRef as Ptr = runningApplications(self)
		    if arrayRef <> nil then
		      dim ns_array as new NSArray(arrayRef)
		      const sizeOfPtr = 4
		      dim arrayRange as Cocoa.NSRange = Cocoa.NSMakeRange(0, ns_array.Count)
		      dim m as MemoryBlock = ns_array.ValuesArray(arrayRange)
		      dim n as UInt32 = arrayRange.length-1
		      for i as integer = 0 to n
		        retArray.append new NSRunningApplication(Ptr(m.UInt32Value(i*sizeOfPtr)))
		      next
		    end if
		    
		    return retArray
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function SelectFile(file as FolderItem) As Boolean
		  
		  #if targetMacOS
		    declare function selectFile lib CocoaLib selector "selectFile:inFileViewerRootedAtPath:" _
		    (obj_id as Ptr, fullPath as CFStringRef, rootFullPath as CFStringRef) as Boolean
		    
		    if file <> nil then
		      return selectFile(self, file.POSIXPath, "")
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function SetDesktopImageURL(aScreen as NSScreen, options as NSDictionary, byRef error as NSError, assigns aURL as NSURL) As Boolean
		  
		  #if targetMacOS
		    declare function setDesktopImageURL lib CocoaLib selector "setDesktopImageURL:forScreen:options:error:" _
		    (obj_id as Ptr, aURL as Ptr, aScreen as Ptr, options as Ptr, byRef error as Ptr) as Boolean
		    
		    dim urlRef as Ptr
		    if aURL <> nil then
		      urlRef = aURL
		    end if
		    
		    dim screenRef as Ptr
		    if aScreen <> nil then
		      screenRef = aScreen
		    end if
		    
		    dim optionsRef as Ptr
		    if options <> nil then
		      optionsRef = options
		    end if
		    
		    dim errorRef as Ptr
		    
		    dim retValue as Boolean = setDesktopImageURL(self, urlRef, screenRef, optionsRef, errorRef)
		    
		    if errorRef <> nil then
		      error = new NSError(errorRef)
		    end if
		    
		    return retValue
		    
		  #else
		    #pragma unused aScreen
		    #pragma unused options
		    #pragma unused error
		    #pragma unused aURL
		  #endif
		  
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function SharedWorkspace() As NSWorkspace
		  
		  #if targetMacOS
		    declare function sharedWorkspace lib CocoaLib selector "sharedWorkspace" (class_id as Ptr) as Ptr
		    
		    static wspace as new NSWorkspace(sharedWorkspace(Cocoa.NSClassFromString("NSWorkspace")))
		    
		    return wspace
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function ShowSearchResults(queryString as String) As Boolean
		  
		  #if targetMacOS
		    declare function showSearchResultsForQueryString lib CocoaLib selector "showSearchResultsForQueryString:" _
		    (obj_id as Ptr, queryString as CFStringRef) as Boolean
		    
		    return showSearchResultsForQueryString(self, queryString)
		    
		  #else
		    #pragma unused queryString
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function UnmountAndEjectDevice(deviceFile as FolderItem) As Boolean
		  
		  #if TargetMacOS
		    declare function unmountAndEjectDeviceAtPath lib CocoaLib selector "unmountAndEjectDeviceAtPath:" (obj_id as Ptr, path as CFStringRef) as Boolean
		    
		    if deviceFile <> nil then
		      return unmountAndEjectDeviceAtPath(self, deviceFile.POSIXPath)
		    end if
		    
		  #else
		    #pragma unused deviceFile
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function UnmountAndEjectDevice(deviceURL as NSURL, byRef error as NSError) As Boolean
		  
		  #if TargetMacOS
		    declare function unmountAndEjectDeviceAtURL lib CocoaLib selector "unmountAndEjectDeviceAtURL:error:" _
		    (obj_id as Ptr, url as Ptr, byRef error as Ptr) as Boolean
		    
		    dim deviceURLRef as Ptr
		    if deviceURL <> nil then
		      deviceURLRef = deviceURL
		    end if
		    
		    dim errorRef as Ptr
		    
		    dim retValue as Boolean = unmountAndEjectDeviceAtURL(self, deviceURLRef, errorRef)
		    
		    if errorRef <> nil then
		      error = new NSError(errorRef)
		    end if
		    
		    return retValue
		    
		  #else
		    #pragma unused deviceURL
		    #pragma unused error
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function UTIConformsTo(UTI as string, ConformsTo as String) As Boolean
		  
		  #if TargetMacOS
		    declare function type_ lib CocoaLib selector "type:conformsToType:" _
		    (obj_id as Ptr, firstTypeName as CFStringRef, secondTypeName as CFStringRef) as Boolean
		    
		    if UTI <> "" and ConformsTo <> "" then
		      return type_(self, UTI, conformsTo)
		    end if
		    
		  #else
		    #pragma unused UTI
		    #pragma unused conformsTo
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function UTILocalizedDescription(UTI as String) As String
		  
		  #if targetMacOS
		    declare function localizedDescriptionForType lib CocoaLib selector "localizedDescriptionForType:" (obj_id as Ptr, typeName as CFStringRef) as CFStringRef
		    
		    return localizedDescriptionForType(self, UTI)
		    
		  #else
		    #pragma unused UTI
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function UTIOfFile(file as FolderItem, byRef error as NSError) As String
		  
		  #if targetMacOS
		    declare function typeOfFile lib CocoaLib selector "typeOfFile:error:" (obj_id as Ptr, absoluteFilePath as CFStringRef, byRef error as Ptr) as CFStringRef
		    
		    if file <> nil then
		      dim errorRef as Ptr
		      dim retValue as String = typeOfFile(self, file.POSIXPath, errorRef)
		      if errorRef <> nil then
		        error = new NSError(errorRef)
		      end if
		      return retValue
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function UTIPreferredFilenameExtension(UTI as String) As String
		  
		  #if targetMacOS
		    declare function preferredFilenameExtensionForType lib CocoaLib selector "preferredFilenameExtensionForType:" (obj_id as Ptr, typeName as CFStringRef) as CFStringRef
		    
		    return preferredFilenameExtensionForType(self, UTI)
		    
		  #else
		    #pragma unused UTI
		  #endif
		  
		End Function
	#tag EndMethod


	#tag Constant, Name = NSExclude10_4ElementsIconCreationOption, Type = Double, Dynamic = False, Default = \"4", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSExcludeQuickDrawElementsIconCreationOption, Type = Double, Dynamic = False, Default = \"2", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchAllowingClassicStartup, Type = Double, Dynamic = False, Default = \"&h00020000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchAndHide, Type = Double, Dynamic = False, Default = \"&h00100000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchAndHideOthers, Type = Double, Dynamic = False, Default = \"&h00200000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchAndPrint, Type = Double, Dynamic = False, Default = \"&h00000002", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchAsync, Type = Double, Dynamic = False, Default = \"&h00010000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchDefault, Type = Double, Dynamic = False, Default = \"&h00030000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchInhibitingBackgroundOnly, Type = Double, Dynamic = False, Default = \"&h00000080", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchNewInstance, Type = Double, Dynamic = False, Default = \"&h00080000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchPreferringClassic, Type = Double, Dynamic = False, Default = \"&h00040000", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchWithoutActivation, Type = Double, Dynamic = False, Default = \"&h00000200", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWorkspaceLaunchWithoutAddingToRecents, Type = Double, Dynamic = False, Default = \"&h00000100", Scope = Public
	#tag EndConstant


	#tag ViewBehavior
		#tag ViewProperty
			Name="Description"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="NSObject"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			Type="Integer"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
